package com.jdk.demo.queue.linkedBlockingQueue;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;

public class Consumer implements Runnable{
    BlockingQueue<String> queue;

    public Consumer(BlockingQueue<String> queue){
        this.queue = queue;
    }

    @Override
    public void run() {
        try {
            // String temp = queue.take();//如果队列为空，会阻塞当前线程
        	// String temp = queue.remove();
        	// String temp = queue.poll(100, TimeUnit.MICROSECONDS);
        	boolean temp = queue.remove("A Product, 生产线程：Producer2");
        	System.out.println(temp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}